<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no"/>
    <title>6-vue中使用css样式</title>
    <style>
        [v-cloak] {
            display: none;
        }

        .box {
            width: 100px;
            height: 100px;
            background-color: #FF0000;
        }

        .show {
            display: block
        }
    </style>
</head>
<body>
<div id="app" v-cloak>
    <div v-bind:class="{box:isBox}"></div>
    <button type="button" v-on:click="isBox=!isBox">显示/隐藏</button>
    <div v-bind:class="['box','show']"></div>
    <div v-bind:style="{fontSize:'20px',color:'#FFFFFF',width:'300px',height:'300px',backgroundColor:'#0000FF'}">我是蓝色盒子</div>
    <div v-bind:style="[baseStyle,fontStyle]">我是数组内联样式</div>
</div>
<script src="js/vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                isBox: true,
                baseStyle: {
                    width: "200px",
                    height: "200px",
                    backgroundColor: "#00FF00"
                },
                fontStyle: {
                    fontSize: "30px",
                    color: "#FF0000"
                }
            }
        }
    })
</script>
</body>
</html>
